$(document).ready(function () {
    var userInfo = JSON.parse(window.localStorage.getItem("userInfo"));
    var ul = $("#side-content");
    if (userInfo.info == 'success') {
        var html = "<ul class='nav-main'>";
        $.each(userInfo.roles,function (i,item) {
        	if(item.roleUrl == "#") {
                html += "<li><a class='nav-submenu' data-toggle='nav-submenu' href='#'><i class='si si-lock'></i><span class='sidebar-mini-hide'>" +item.roleTitle+ "</span></a><ul>";
                //ul.append("<li><a class='nav-submenu' data-toggle='nav-submenu' href='#'><i class='si si-lock'></i><span class='sidebar-mini-hide'>" +item.roleTitle+ "</span></a><ul>");
                $.each(userInfo.roles,function (i,item2) {
                	if(item2.pid == item.id){
                        //ul.append("<li><a href='" +item2.roleUrl+ "' target='rightPage'>" +item2.roleTitle+ "</a></li>");
                        html += "<li><a href='" +item2.roleUrl+ "' target='rightPage'>" +item2.roleTitle+ "</a></li>";
                    }
                })
				html += "</ul></li>";
                //ul.append("</ul></li>");
			}
        });
        html += "</ul>";
        console.log(html);
        ul.prepend(html);
        //$ul.trigger("updatelayout");
    } else {
        alert("服务器响应失败。");
    }
});